package com.kuaishou.test.config;

import javax.annotation.Nonnull;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.kuaishou.infra.boot.converter.HasIntValueConverter;
import com.kuaishou.test.plugin.ApplicationWebServerCustomizer;

/**
 * Spring MVC 配置
 *
 * Write the code. Change the world.
 *
 * @author trang
 */
@Configuration
class SpringMvcConfig {

    @Bean
    ApplicationWebServerCustomizer applicationWebServerCustomizer() {
        return new ApplicationWebServerCustomizer();
    }

    @Bean
    WebMvcConfigurer webMvcConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addFormatters(@Nonnull FormatterRegistry registry) {
                // 用于 string <==> HasIntValue 之间的转换
                HasIntValueConverter converter = new HasIntValueConverter();
                registry.addConverter(converter);
            }

        };
    }

    public static void main(String[] args) {
        System.out.println( 1 << 5);
    }


}
